package com.dylan.springcloud.clientservice.service.impl;

import com.dylan.springcloud.clientservice.service.UserSerice;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.stereotype.Service;

/**
 * Created by Dylan on 2018/10/18.
 */
@Service
public class UserSericeImpl implements UserSerice {

    @HystrixCommand(fallbackMethod = "defaultGetUser")
    @Override
    public String getUser(String username) throws Exception {
        if (username.contains("spring")) {
            return "这是一个真实姓名";
        }
        throw new Exception("姓名错误");
    }


    public String defaultGetUser(String username) {
        return "这不是一个真实姓名：" + username;
    }
}
